package com.ruoyi.web.controller.industryInformation;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.IndustryInformation;
import com.ruoyi.system.service.IIndustryInformationService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 行业资讯Controller
 * 
 * @author Eugene
 * @date 2023-04-15
 */
@Api(tags = "行业资讯")
@RestController
@RequestMapping("/IndustryInformation/industryInformation")
public class IndustryInformationController extends BaseController
{
    @Autowired
    private IIndustryInformationService industryInformationService;

    /**
     * 查询行业资讯列表
     */
    @ApiOperation("查询行业资讯列表")
    @PreAuthorize("@ss.hasPermi('IndustryInformation:industryInformation:list')")
    @GetMapping("/list")
    public TableDataInfo list(IndustryInformation industryInformation)
    {
        startPage();
        List<IndustryInformation> list = industryInformationService.selectIndustryInformationList(industryInformation);
        return getDataTable(list);
    }

    /**
     * 导出行业资讯列表
     */
    @PreAuthorize("@ss.hasPermi('IndustryInformation:industryInformation:export')")
    @Log(title = "行业资讯", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, IndustryInformation industryInformation)
    {
        List<IndustryInformation> list = industryInformationService.selectIndustryInformationList(industryInformation);
        ExcelUtil<IndustryInformation> util = new ExcelUtil<IndustryInformation>(IndustryInformation.class);
        util.exportExcel(response, list, "行业资讯数据");
    }

    /**
     * 获取行业资讯详细信息
     */
    @ApiOperation("获取行业资讯详细信息")
    @PreAuthorize("@ss.hasPermi('IndustryInformation:industryInformation:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(industryInformationService.selectIndustryInformationById(id));
    }

    /**
     * 新增行业资讯
     */
    @ApiOperation("新增行业资讯")
    @PreAuthorize("@ss.hasPermi('IndustryInformation:industryInformation:add')")
    @Log(title = "行业资讯", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody IndustryInformation industryInformation)
    {
        return toAjax(industryInformationService.insertIndustryInformation(industryInformation));
    }

    /**
     * 修改行业资讯
     */
    @ApiOperation("修改行业资讯")
    @PreAuthorize("@ss.hasPermi('IndustryInformation:industryInformation:edit')")
    @Log(title = "行业资讯", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody IndustryInformation industryInformation)
    {
        return toAjax(industryInformationService.updateIndustryInformation(industryInformation));
    }

    /**
     * 删除行业资讯
     */
    @ApiOperation("删除行业资讯")
    @PreAuthorize("@ss.hasPermi('IndustryInformation:industryInformation:remove')")
    @Log(title = "行业资讯", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(industryInformationService.deleteIndustryInformationByIds(ids));
    }
}
